/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entite;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author david.tamisier
 */
@Entity
@Table(name = "questionnairequestion", catalog = "feedbackform", schema = "")
public class QuestionnaireQuestion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Basic(optional = false)
    @Column(name = "ordre", nullable = false)
    private int ordre;
    @JoinColumn(name = "idQuestion", referencedColumnName = "id", nullable = false)
    @ManyToOne(optional = false)
    private Question question;
    @JoinColumn(name = "idQuestionnaire", referencedColumnName = "id", nullable = false)
    @ManyToOne(optional = false)
    private Questionnaire questionnaire;

     @Transient
    private Integer reponse;

    /**
     *
     */
    public QuestionnaireQuestion() {
    }

    /**
     *
     * @param ordre
     * @param question
     * @param questionnaire
     */
    public QuestionnaireQuestion(int ordre, Question question, Questionnaire questionnaire) {
        this.ordre = ordre;
        this.question = question;
        this.questionnaire = questionnaire;
    }

    /**
     *
     * @return
     */
    public Integer getId() {
        return id;
    }

    /**
     *
     * @param id
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     *
     * @return
     */
    public int getOrdre() {
        return ordre;
    }

    /**
     *
     * @param ordre
     */
    public void setOrdre(int ordre) {
        this.ordre = ordre;
    }

    /**
     *
     * @return
     */
    public Question getQuestion() {
        return question;
    }

    /**
     *
     * @param question
     */
    public void setQuestion(Question question) {
        this.question = question;
    }

    /**
     *
     * @return
     */
    public Questionnaire getQuestionnaire() {
        return questionnaire;
    }

    /**
     *
     * @param questionnaire
     */
    public void setQuestionnaire(Questionnaire questionnaire) {
        this.questionnaire = questionnaire;
    }

    /**
     * La réponse
     * @return
     */
    public Integer getReponse() {
        return reponse;
    }

    /**
     * La réponse
     * @param reponse
     */
    public void setReponse(Integer reponse) {
        this.reponse = reponse;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof QuestionnaireQuestion)) {
            return false;
        }
        QuestionnaireQuestion other = (QuestionnaireQuestion) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entite.QuestionnaireQuestion[id=" + id + "]";
    }

}
